from apps.chat.conversation.baseViews import *

class ConversationViewSet(BaseConversationViewSet):

    def get_queryset(self):
        params = getRequestParams(self.request)
        _list = Conversation.objects.filter(Q(userA=self.request.user) | Q(userB=self.request.user))
        _list = _list.filter((Q(conversationType='custom', userA__is_delete=0, userB__is_delete=0, userA__checkStatus="PASS", userB__checkStatus="PASS") | Q(conversationType='system')), is_delete=0)
        _list = _list.select_related('userA', 'userB')
        return _list.order_by('-lastMessage__createTime')
